home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / SuperiorCanfield.dxr / playing cards_57_foundation cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  2.9 KB  |  103 lines

  1. property spriteNum, motion, undercard, row, location
  2. global getlist, stock, equal, currentsel, godlist, foundation, points, tableau, basecard
  3.  
  4. on beginSprite me
  5.   row = determinerow()
  6.   undercard = sprite(spriteNum - 4)
  7.   location = sprite(spriteNum).loc
  8.   foundation.addProp(row, new(script("card pile")))
  9.   if foundation.count = 1 then
  10.     sprite(spriteNum).member = member(stock.cards[1].rank & "_" & stock.cards[1].suit, "playing cards")
  11.     basecard = stock.cards[1].rank
  12.     stock.cards.deleteAt(1)
  13.     foundation[row].addCard(spriteNum)
  14.   end if
  15. end
  16.  
  17. on mouseDown me
  18.   if foundation[row].getcardcount() > 0 then
  19.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  20.     sprite(spriteNum).locZ = spriteNum + 1000
  21.     getlist = foundation[row]
  22.     if foundation[row].getcardcount() > 1 then
  23.       undercard.member = member(foundation[row].cards[foundation[row].getcardcount() - 1].membername, "playing cards")
  24.     else
  25.       if foundation[row].getcardcount() = 1 then
  26.         undercard.member = member("empty", "playing cards")
  27.       end if
  28.     end if
  29.     motion = timeout(string(spriteNum) && "motion").new(5, #moving, me)
  30.   end if
  31. end
  32.  
  33. on moving me
  34.   if the mouseDown then
  35.     sprite(spriteNum).loc = the mouseLoc
  36.   else
  37.     if the mouseUp then
  38.       sprite(spriteNum).locZ = spriteNum
  39.       motion.forget()
  40.       abort()
  41.     end if
  42.   end if
  43. end
  44.  
  45. on mouseUp me
  46.   if equal then
  47.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  48.     sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
  49.     godlist.addCard(currentsel)
  50.     sprite(spriteNum).loc = location
  51.     foundation[row].cards.deleteOne(foundation[row].getlastcard())
  52.     if foundation[row].getcardcount() > 0 then
  53.       sprite(spriteNum).member = member(foundation[row].getlastcard().membername, "playing cards")
  54.     else
  55.       if foundation[row].getcardcount() = 0 then
  56.         sprite(spriteNum).member = member("empty", "playing cards")
  57.         undercard.member = member("empty", "playing cards")
  58.       end if
  59.     end if
  60.     if objectp(tableau[sprite(currentsel).row]) then
  61.       repeat with i = 93 to 96
  62.         if tableau[sprite(i).row].getcardcount() = 0 then
  63.           next repeat
  64.         end if
  65.         sprite(i).loc = tableau[sprite(i).row].getlastcard().location
  66.       end repeat
  67.     end if
  68.     if not objectp(foundation[sprite(currentsel).row]) then
  69.       points = points - 10
  70.     end if
  71.     equal = 0
  72.     currentsel = 0
  73.     godlist = VOID
  74.     getlist = VOID
  75.     checkwin()
  76.   else
  77.     if not equal then
  78.       puppetSound(3, member("drop card", "100GPak Generic SFX"))
  79.       getlist = VOID
  80.       sprite(spriteNum).loc = location
  81.     end if
  82.   end if
  83.   checkwin()
  84. end
  85.  
  86. on determinerow me
  87.   if spriteNum = 29 then
  88.     return #fone
  89.   else
  90.     if spriteNum = 30 then
  91.       return #ftwo
  92.     else
  93.       if spriteNum = 31 then
  94.         return #fthree
  95.       else
  96.         if spriteNum = 32 then
  97.           return #ffour
  98.         end if
  99.       end if
  100.     end if
  101.   end if
  102. end
  103.